package cn.wolfcode.luowowo.util;


import cn.wolfcode.luowowo.exception.LogicException;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;

public class AssertUtil {

    public static void hasLength( String text, String message) {
        if (!StringUtils.hasLength(text)) {
            throw new LogicException(message);
        }
    }

    /**
     * 两次密码是否一致
     * @param v1
     * @param v2
     * @param msg
     */
    public static void isEquals(String v1, String v2, String msg) {
        //得判空
        if(v1 == null || v2 == null){
            throw new LogicException("密码或者重复密码不能为空");
        }
        if (!v1.equals(v2)) {
            throw new LogicException(msg);
        }
    }
}
